package com.charlotte.study.gupao.adapter.login.v2;


import com.charlotte.study.gupao.adapter.login.v1.BaseResponse;
import com.charlotte.study.gupao.adapter.login.v2.adapters.AbstractAdapter;
import com.charlotte.study.gupao.adapter.login.v2.adapters.ILoginAdapter;
import com.charlotte.study.gupao.adapter.login.v2.adapters.LoginForQQAdapter;
import com.charlotte.study.gupao.adapter.login.v2.adapters.LoginForWechatAdapter;

import java.util.Map;

/**
 * @author junjie.ding
 * @date 2020/3/11
 */
public class PassportForThirdAdapter implements IPassportForThird {

    @Override
    public BaseResponse loginForThird(Map objects, Class<? extends ILoginAdapter> clazz) {
        try {
            ILoginAdapter adapter = clazz.newInstance();
            return adapter.login(objects, adapter);
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        return null;
    }
}
